import pandas as pd

def convert_qxc_excel_to_csv(excel_file_path, sheet_name, output_csv_path):
    """
    将七星彩的Excel文件转换为特定格式的CSV文件
    :param excel_file_path: Excel文件路径
    :param sheet_name: 需要转换的Sheet名称
    :param output_csv_path: 输出的CSV文件路径
    """
    df = pd.read_excel(excel_file_path, sheet_name=sheet_name)
    
    # 假设七星彩数据在指定列，需要提取和格式化
    df = df[['开奖日期', '号码1', '号码2', '号码3', '号码4', '号码5', '号码6', '号码7']]
    df.columns = ['date', 'num1', 'num2', 'num3', 'num4', 'num5', 'num6', 'num7']
    
    df.to_csv(output_csv_path, index=False)
    print(f"七星彩数据已转换为CSV格式，保存到 {output_csv_path}")

if __name__ == "__main__":
    excel_file_path = "data/raw/qxc/lottery_data.xlsx"
    sheet_name = "Sheet1"
    output_csv_path = "data/raw/qxc/lottery_data.csv"
    
    convert_qxc_excel_to_csv(excel_file_path, sheet_name, output_csv_path)